package com.heartware.sh.blackhole.retrofit;

import com.heartware.sh.blackhole.entity.BaseEntity;
import com.heartware.sh.blackhole.entity.Entity;
import com.heartware.sh.blackhole.entity.test.MyEntity;
import com.heartware.sh.blackhole.entity.UserEntitiy;
import com.heartware.sh.blackhole.entity.req.RegUserReq;

import java.util.List;
import java.util.Map;

import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import rx.Observable;

/**
 * Created by Administrator on 2016/11/30 0030.
 */
public interface BlackHoleService {

    String base_api = "https://leancloud.cn:443/1.1/";


    @GET("abc/abc/{no}")
    Observable<MyEntity> getList(@Path("no") int no);

    /**
     * 登录
     */

    @GET("login")
    @Headers({"X-LC-Id:bXguyPu14fDxdz97qBj96T8t-gzGzoHsz", "X-LC-Key:PHcC71AbABVzI7mU3WdDSrkr"})
    Observable<UserEntitiy> getUserInfo(@Query("username") String username, @Query("password") String password);
//    @GET("login")
//    Observable<UserEntitiy> getUserInfo(@QueryMap Map<String, String> params);

    @POST("users")
    @Headers({"X-LC-Id:bXguyPu14fDxdz97qBj96T8t-gzGzoHsz", "X-LC-Key:PHcC71AbABVzI7mU3WdDSrkr"})
    Observable<UserEntitiy> doReg(@Body RegUserReq regUserReq);


    //-----
//    @GET("http://www.juzimi.com/meitumeiju")
//    @FormUrlEncoded
//    @POST("http://www.gifcool.com/appdata/getlist.php")
//    Observable<BaseEntity<List<Entity>>> getMeiTuMeiJu(@QueryMap Map<String ,Object> tm);
    @POST("http://www.gifcool.com/appdata/getlist.php")
    Observable<BaseEntity<List<Entity>>> getMeiTuMeiJu(@Body RequestBody requestBody);

//    .add("current", index)
//                .add("pagesize", 20)
//                .add("typeid", 12)
//                .add("version", "1.0.0")
//    @FormUrlEncoded
//    @POST("http://www.gifcool.com/appdata/getlist.php")
//    Observable<BaseEntity<List<Entity>>> getMeiTuMeiJu(@Field("current") int index, @Field("pagesize") int pagesize, @Field("typeid") int typeId, @Field("version") String version);

}
